class BounceBezier extends AwareObj{
  
  BasePoint p1;
  BasePoint p2;
  BasePoint p3;
  BasePoint p4;
  color c;
  color startColor;
  color endColor;
  int maxSteps;

  BounceBezier( BasePoint b1, BasePoint b2, BasePoint b3, BasePoint b4){
    p1 = b1;
    p2 = b2;
    p3 = b3;
    p4 = b4;
    startColor = color( int(random( 256)), int(random( 256)), int(random( 256)));
    endColor = color( int(random( 256)), int(random( 256)), int(random( 256)));
    maxSteps = 250;

    c = color( int(random( 256)), int(random( 256)), int(random( 256)));
  }

  void update(){
    stroke( c);
    noFill();
    int steps = maxSteps;
    noStroke();
    for (int i = 0; i < steps; i++) {
      float t = i / float(steps);
      color eColor = lerpColor( startColor, endColor, i / float(steps));
      fill( eColor);
      float x = bezierPoint( p1.getX(), p2.getX(), p3.getX(), p4.getX(), t);
      float y = bezierPoint( p1.getY(), p2.getY(), p3.getY(), p4.getY(), t);
      ellipse(x, y, circleRadius, circleRadius);
    }
    noFill();
    bezier( p1.getX(), p1.getY(),
            p2.getX(), p2.getY(),
            p3.getX(), p3.getY(),
            p4.getX(), p4.getY());
  };
  
  void setStartColor( color c){
    startColor = c;
  };

  void setEndColor( color c){
    endColor = c;
  };

}

